<?php /*a:2:{s:91:"E:\xiaopi\phpstudy_pro\WWW\zhengmaotong\public/themes/admin_default/admin\nav_menu\add.html";i:1695775678;s:86:"E:\xiaopi\phpstudy_pro\WWW\zhengmaotong\public/themes/admin_default/public\header.html";i:1695775678;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->

    <link href="/themes/admin_default/public/assets/themes/<?php echo cmf_get_admin_style('arcoadmin'); ?>/bootstrap.min.css" rel="stylesheet">
    <link href="/themes/admin_default/public/assets/simpleboot/css/simplebootadmin.css" rel="stylesheet">
    <link href="/static/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="/themes/admin_default/public/assets/themes/<?php echo cmf_get_admin_style('arcoadmin'); ?>/simplebootadmin.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <?php 
        $is_mobile=cmf_is_mobile();
        $_static_version='1.0.5';
        $cmf_version=cmf_version();
        if (preg_match("/^(8|6)\./",$cmf_version)) {
        $_app=app()->http->getName();
        }else{
        $_app=request()->module();
        }
     ?>
    <script type="text/javascript">
        //全局变量
        var GV = {
            ROOT: "/",
            WEB_ROOT: "/",
            JS_ROOT: "static/js/",
            API_ROOT: {api: '/api/'},
            APP: '<?php echo $_app; ?>'/*当前应用名*/,
            IS_MOBILE: <?php echo !empty($is_mobile) ? 'true'  :  'false'; ?>
        };
    </script>
    <script src="/themes/admin_default/public/assets/js/jquery-1.12.4.min.js"></script>
    <script src="/themes/admin_default/public/assets/js/jquery-migrate-1.4.1.min.js"></script>
    <script src="/static/js/wind.js"></script>
    <script src="/themes/admin_default/public/assets/js/bootstrap.min.js"></script>
    <script>
        Wind.alias({noty: '/themes/admin_default/public/assets/js/noty-2.4.1.js'})
    </script>
    <script>
        Wind.css('artDialog');
        Wind.css('layer');
        $(function () {
            $("[data-toggle='tooltip']").tooltip({
                container: 'body',
                html: true,
            });
            $("li.dropdown").hover(function () {
                $(this).addClass("open");
            }, function () {
                $(this).removeClass("open");
            });
        });
    </script>
    <?php if(APP_DEBUG): ?>
        <style>
            #think_page_trace_open {
                z-index: 9999;
            }
        </style>
    <?php endif; ?>

</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="<?php echo url('NavMenu/index',['nav_id'=>$nav_id]); ?>"><?php echo lang('ADMIN_NAVMENU_INDEX'); ?></a></li>
        <li class="active"><a><?php echo lang('ADMIN_NAVMENU_ADD'); ?></a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="admin/nav/menus">
        <fieldset>
            <div class="form-group">
                <label class="col-sm-2 control-label"><?php echo lang('Parent'); ?></label>
                <div class="col-md-8 col-sm-10">
                    <select name="parent_id" class="form-control">
                        <option value="0">/</option>
                        <?php echo $nav_trees; ?>
                    </select>
                </div>
            </div>
            <div class="form-group form-inline">
                <label class="col-sm-2 control-label"><span class="form-required">*</span><?php echo lang('Url'); ?></label>
                <div class="col-md-8 col-sm-10">
                    <input type="radio" id="external-link-radio">
                    <input type="text" class="form-control" name="href" id="external-link-input">
                    <input type="radio" id="select-href-radio">
                    <select name="href" id="select-href" class="form-control">
                        <option value="<?php echo base64_encode('home'); ?>" data-name="<?php echo lang('HOME'); ?>"><?php echo lang('HOME'); ?></option>
                        <?php if(is_array($navs) || $navs instanceof \think\Collection || $navs instanceof \think\Paginator): if( count($navs)==0 ) : echo "" ;else: foreach($navs as $key=>$vo): ?>
                            <optgroup label="<?php echo $vo['name']; ?>">
                                <?php echo $vo['html']; ?>
                            </optgroup>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><span class="form-required">*</span><?php echo lang('Name'); ?></label>
                <div class="col-md-8 col-sm-10">
                    <input type="text" class="form-control" name="name" id="name-input">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><?php echo lang('Url Target'); ?></label>
                <div class="col-md-8 col-sm-10">
                    <select class="form-control" name="target">
                        <option value=""><?php echo lang('Default'); ?></option>
                        <option value="_blank">_Blank</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><?php echo lang('Icon'); ?></label>
                <div class="col-md-8 col-sm-10">
                    <input type="text" class="form-control" name="icon" value="">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><?php echo lang('Status'); ?></label>
                <div class="col-md-8 col-sm-10">
                    <select name="status" class="form-control">
                        <option value="1"><?php echo lang('DISPLAY'); ?></option>
                        <option value="0"><?php echo lang('HIDDEN'); ?></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"></label>
                <div class="col-md-8 col-sm-10">
                    <input type="hidden" name="nav_id" value="<?php echo $nav_id; ?>"/>
                    <button type="submit" class="btn btn-primary js-ajax-submit">
                        <i class="fa fa-save fa-fw"></i> <?php echo lang('ADD'); ?>
                    </button>
                    <a class="btn btn-default" href="<?php echo url('NavMenu/index',['nav_id'=>$nav_id]); ?>"><?php echo lang('BACK'); ?></a>
                </div>
            </div>
        </fieldset>
    </form>

</div>
<script src="/static/js/admin.js?v=<?php echo $_static_version; ?>"></script>
<script>
    $(function () {
        $("#select-href,#select-href-radio").click(function () {
            checkChange(2);
        });

        $("#select-href").change(function () {
            var $this = $(this);
            var label = $this.find("option[value='" + $this.val() + "']").data('name');
            $('#name-input').val(label);
        });

        $("#external-link-input,#external-link-radio").click(function () {
            checkChange(1);
        });

        function checkChange(i) {
            if (i == 1) {
                //自动输入url
                $('#external-link-input').attr('name', 'external_href');
                $('#select-href').removeAttr('name');
                $('#select-href-radio').prop('checked', false);
                $('#external-link-radio').prop('checked', true);
            } else {
                //选择链接url
                $('#select-href').attr('name', 'href');
                $('#external-link-input').removeAttr('name');
                $('#select-href-radio').prop('checked', true);
                $('#external-link-radio').prop('checked', false);
            }
        }
    });
</script>
</body>
</html>
